package unit3;

public class Ex3_8_TestPassByValue {
    public static void main(String[] args) {
        int num1 = 1;
        int num2 = 2;
        System.out.println("调用swap方法之前, num1的值：" + num1 +
                           " , num2的值: " + num2);
        swap(num1, num2); //调用swap方法
        System.out.println("调用swap方法之后, num1的值：" + num1 +
                           " , num2的值: " + num2);
    }
    static void swap(int n1, int n2) { //交换n1、n2两个形参变量的值
        System.out.println("－－－－－swap方法内部－－－－－－－－");
        System.out.println("    n1、n2的值交换之前 n1的值： " + n1 +
                           " n2的值：" + n2);
        int temp = n1;
        n1 = n2;
        n2 = temp;
        System.out.println("    n1、n2的值交换之后 n1的值： " + n1 +
                           " n2的值：" + n2);
    }
}
